#!/bin/sh
#
# Copyright 2018, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: GPL-2.0-only
#

# Script for testing cross vm dataport support

READ=dataport_read
WRITE=dataport_write

DP1_NAME=/dev/dp1
DP2_NAME=/dev/dp2

MESSAGE1="Hello, World!"
MESSAGE2="abcdefghijklmnopqrstuvwxyz"

LARGE_FILE=/opt/text/lipsum

echo "Writing to $DP1_NAME: '$MESSAGE1'"
echo $MESSAGE1 | $WRITE $DP1_NAME
echo "Reading from $DP1_NAME: '`$READ $DP1_NAME`'"

echo "Writing to $DP2_NAME: '$MESSAGE2'"
echo $MESSAGE2 | $WRITE $DP2_NAME
echo "Reading from dataport: '`$READ $DP2_NAME`'"

echo "Filling $DP2_NAME..."
cat $LARGE_FILE | $WRITE $DP2_NAME
